import { Callout } from "nextra/components";
import VideoEmbed from "../../components/video-embed";

# Building Detection

> Specialized detection of buildings in satellite imagery

<VideoEmbed
  src="https://geobase-docs.s3.amazonaws.com/geobase-ai-assets/building-detection.mp4"
  title="Building Detection Demo"
/>

<div style={{ textAlign: 'center', marginTop: '1rem' }}>
  <a 
    href="https://docs.geobase.app/geoai-live/tasks/building-detection" 
    target="_blank" 
    rel="noopener noreferrer"
    style={{ 
      display: 'inline-flex', 
      alignItems: 'center', 
      gap: '0.5rem',
      padding: '0.5rem 1rem',
      backgroundColor: '#3b82f6',
      color: 'white',
      textDecoration: 'none',
      borderRadius: '0.375rem',
      fontWeight: '500',
      transition: 'background-color 0.2s'
    }}
    className="live-demo-button"
  >
    🚀 Try Live Demo
  </a>
</div>

<style jsx>{`
  .live-demo-button:hover {
    background-color: #2563eb !important;
  }
`}</style>

<div style={{ textAlign: 'center', marginTop: '0.5rem' }}>
  <a 
    href="https://huggingface.co/geobase/building-detection" 
    target="_blank" 
    rel="noopener noreferrer"
    style={{ 
      fontSize: '0.875rem',
      color: '#6b7280',
      textDecoration: 'none'
    }}
  >
    🤗 View Model on Hugging Face
  </a>
</div>

## Quick Start

```typescript
import { geoai } from "geoai";

// Initialize pipeline
const pipeline = await geoai.pipeline(
  [{ task: "building-detection" }],
  providerParams
);

// Run detection
const result = await pipeline.inference({
  inputs: { polygon: myPolygon },
});

console.log(`Found ${result.detections.features.length} buildings`);
```

## Parameters

### Map Source

```typescript
mapSourceParams: {
  zoomLevel: 20; // 19-22 recommended
}
```

## Output

Returns GeoJSON with detected buildings:

```typescript
{
  detections: {
    type: "FeatureCollection",
    features: [
      {
        geometry: { /* building polygon */ },
        properties: {}
      }
    ]
  }
}
```
